package cn.jb698.codec.enums;


/**
 * 字段查询类型: 查询类型,EQ,NE,GT,GE,LT,LE,LIKE,RANGE
 * @author LIU
 * @date 2024-08-24 21:47:12
 */
public enum ColumnQueryTypeEnum {

    /**
     * 字段查询类型: 查询类型,EQ,NE,GT,GE,LT,LE,LIKE,RANGE
     */
	EQ("EQ","等于"), 
	NE("NE","不等于"), 
	GT("GT","大于"), 
	GE("GE","大于等于"), 
	LT("LT","小于"), 
	LE("LE","小于等于"), 
	LIKE("LIKE","模糊查询"), 
	BETWEEN("BETWEEN","范围查询"), 
	;

	private String code ;
	private String name ;

	public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    ColumnQueryTypeEnum(String code , String name ){
		this.code = code ;
		this.name = name;
	}


	/**
	 * 根据编码获取枚举
	 * @param code
	 * @return
	 */
	public static ColumnQueryTypeEnum getByCode(String code){
		if(code == null ) {
			return null;
		}
		for(ColumnQueryTypeEnum tmpEnum : values() ){
			if(tmpEnum.getCode().equals(code) ){
				return tmpEnum ;
			}
		}
		return null ;
	}
	
	/**
	 * CODE是否符合
	 * @param code
	 * @return
	 */
	public static boolean isCodeValid(String code){
		if(code == null ) {
			return false;
		}
		for(ColumnQueryTypeEnum tmpEnum : values() ){
			if(tmpEnum.getCode().equals(code) ){
				return true ;
			}
		}
		return false ;
	}
	
}
